package leo.game.stage
{
	import flash.display.Bitmap;
	import flash.display.BitmapData;
	import flash.display.MovieClip;
	import flash.display.Sprite;
	import flash.display.StageScaleMode;
	import flash.events.Event;
	import flash.events.MouseEvent;
	import flash.events.TimerEvent;
	import flash.system.ApplicationDomain;
	
	import leo.TDGame;
	import leo.data.Config;
	import leo.data.GameConfig;
	import leo.data.GameConst;
	import leo.game.ui.ToolTip;
	import leo.game.ui.UIBottom;
	import leo.game.ui.UILevel;
	import leo.game.ui.UILose;
	import leo.game.ui.UIMap;
	import leo.game.ui.UITooltip;
	import leo.game.ui.UITop;
	import leo.game.ui.UIWin;
	import leo.manager.BitmapManager;
	import leo.manager.LoaderManager;
	import leo.manager.McMannager;
	import leo.manager.SoundManager;
	
	/**
	 * 游戏类 
	 * @author leo
	 * 
	 */	
	public class Game extends BaseStage
	{
		private static var _instance :Game = null;

		public function Game()
		{
			super();
			init();

			this.refreshInterval = 30;
		}
		
		public static function get instance():Game
		{
			if(_instance == null)
			{
				_instance = new Game();
			}
			return _instance;
		}
		

		
		override protected function refreshHandler(event:TimerEvent):void
		{
			UIMap.instance.update();
		}
		
		override protected function mouseHandler(event:MouseEvent):void
		{
		}
		
		private function init():void
		{
			this.addChild(UIMap.instance);
			var name :String = GameConfig.map_name_ary[0];
			UIMap.instance.setMap(name);
			
			UIBottom.instance.y = 650;
			this.addChild(UIBottom.instance);
			
			UITop.instance.y = -50;
			this.addChild(UITop.instance);
			
			UILevel.instance.y = 300;
			this.addChild(UILevel.instance);
			UILevel.instance.showUILevel(500,250,250);
			
			this.addChild(UIWin.instance);
			UIWin.instance.y = 200;
			UIWin.instance.x = -300;
			
			this.addChild(UILose.instance);
			UILose.instance.x = -300;
			UILose.instance.y = 300;
			
			this.addChild(UITooltip.instance);
			UITooltip.instance.hideTooltip();
			
		}

	}
}